﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class my_newclass_edit : AdminpageBase
{
    protected string strtitle = "";
    protected Model.Newsclass model=null;
    protected string ctype = ReadRequest.RequestString("t");
    protected int long_eid = ReadRequest.RequestInt("eid");
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            inidata();      
        }
    }
    private void inidata()
    {
        if (ctype != null && "edit".Equals(ctype))
        {
            model = BLL.Newsclass.GetModel(long_eid);
            strtitle = model.classname;
            if (model != null)
            {
                texteid.Text = long_eid.ToString();
                txtTitle.Text = model.classname;
                txtContent.Value = model.newsdis;
            }
        }
    }

    //提交按钮事件
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        Model.Newsclass m = BLL.Newsclass.GetModel(long.Parse(texteid.Text));
        if (m != null)
        {
            m.classname = txtTitle.Text;
            m.newsdis = txtContent.Value;
            m.addtime = DateTime.Now;
            if (BLL.Newsclass.Update(m) > 0)
            {
                Response.Write("<script type=\"text/javascript\">alert('保存成功！');window.location.href = '/manage/right.aspx';</script>");
                return;
            }
        } 
    }
}